/*  
 Copyright 2010 The 'Tribe.Blog' development team  
 (http://tribecache.codeplex.com/team/view)

 This library is licensed under the Ms-PL Microsoft Public License.  You should 
 have received a copy of the license along with the source code.  If not, an online copy
 of the license can be found at http://tribecache.codeplex.com/license.
*/

using System;
using Tribe.Cache.Storage;

namespace Tribe.Cache.Factory
{
    /// <summary>
    /// CacheFactory - Used create or get the singleton instance of the cache table
    /// </summary>
    public class CacheFactory : ICacheFactory
    {
        internal static volatile CacheTable CacheTable;

        private static readonly object CacheSyncRoot = new Object();


        /// <summary>
        /// Will create a singleton instance of the cache table
        /// </summary>
        /// <returns></returns>
        public void CreateCache()
        {
            if (CacheTable != null) return;
            
            lock (CacheSyncRoot)
            {
                if (CacheTable == null)
                    CacheTable = new CacheTable();
            }
        }
    }
}